Update jwt#shopify_user_id to return an integer #1103
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
It seems that we've introduced a slight bug for developers who are developing with the shopify_app gem.
Now that core returns the sub field of a jwt as a string, the following validation fails for any app that is developing with online access tokens using shopify_app:
shopify_app/app/controllers/shopify_app/callback_controller.rb
Line 87 in 2401342
In this scenario, the associated_user_id parsed by omniauth remains an Integer, but the jwt_shopify_user_id parsed by our middleware is now a String. There is a type mismatch. The easiest solution for this is to cast the sub field as an integer in our middleware to ensure that everything still works with omniauth as intended (I think this is fine because it's the developer's prerogative to decide what to do with the sub field).
This issue was flagged by Sneha here: https://shopify.slack.com/archives/CG71G24BZ/p1604674034310200
Before submitting the PR, please consider if any of the following are needed:
CHANGELOG.md
if the changes would impact usersREADME.md
, if appropriate.docs/
, if necessary